package hocusPocus.IHM;

import hocusPocus.Controllers.ControllerChoixFinTour;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.WindowConstants;
import java.awt.Toolkit;

public class ChoixFinTour extends JFrame {
	private static final long serialVersionUID = 1L;
	public static boolean piocherCarte = false;
	public static boolean piocherGemmes = false;
	public JRadioButton cartes;
	public JRadioButton gemme;
	public ButtonGroup group;
	public JButton ok;
	
	/**
	 * Creer la fenetre qui permet de choisir le 
	 * type de pioche du joueur gaganant le tour
	 */
	
	public ChoixFinTour(InterfacePlateau interfacePlateau){
		setIconImage(Toolkit.getDefaultToolkit().getImage(ChoixFinTour.class.getResource("/images/icone.gif")));
		setResizable(false);
		setTitle("Hocus Pocus");
		ControllerChoixFinTour controleChoixFinTour = new ControllerChoixFinTour(this, interfacePlateau);
		this.setBounds(100, 100, 299, 207);
		this.setLocationRelativeTo(this.getParent());
		this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		this.getContentPane().setLayout(null);
		JLabel label = new JLabel("Fin du tour, choisir type de pioche : ");
		label.setBounds(22, 11, 219, 14);
		this.getContentPane().add(label);

		group = new ButtonGroup();
		cartes = new JRadioButton("2 cartes");
		cartes.setBounds(91, 48, 109, 23);
		cartes.addActionListener(controleChoixFinTour);
		this.getContentPane().add(cartes);

		gemme= new JRadioButton("1 gemme");
		gemme.setBounds(91, 85, 109, 23);
		gemme.addActionListener(controleChoixFinTour);
		this.getContentPane().add(gemme);

		group.add(cartes);
		group.add(gemme);

		ok = new JButton("OK");
		ok.setBounds(98, 135, 89, 23);
		ok.addActionListener(controleChoixFinTour);
		
		this.getContentPane().add(ok);
		this.setVisible(true);
	}
}
